<?php
/**
 * Copyright (c) 2006, PORTALIER Julien
 * 
 * Licensed under The LGPL License
 * Redistributions of files must retain the above copyright notice.
 * 
 * @copyright    Copyright (c) 2006, Julien PORTALIER
 * @link         http://code.google.com/p/feather-cm
 * @license      http://www.opensource.org/licenses/lgpl-license.php The LGPL License
 */

class Smiler
{
	static function transforms($text)
	{
		$from = array(
			'/(?<!\b)(:\)|:-\))/',
			'/(?<!\b)(:D|:-D)/',
			'/(?<!\b)(;\)|;-\))/',
			'/(?<!\b)(:\||:-\|)/',
			'/(?<!\b)(:\(|:-\()/',
			'/(?<!\b)(:O|:-O)/',
			"/(?<!\b):'\(/",
			'/(?<!\b)(B\)|B-\))/',
		);
		$to = array(
			'<img class="smile" src="/img/smileys/face-smile.png" alt="\1" />',
			'<img class="smile" src="/img/smileys/face-smile-big.png" alt="\1" />',
			'<img class="smile" src="/img/smileys/face-wink.png" alt="\1" />',
			'<img class="smile" src="/img/smileys/face-plain.png" alt="\1" />',
			'<img class="smile" src="/img/smileys/face-sad.png" alt="\1" />',
			'<img class="smile" src="/img/smileys/face-surprise.png" alt="\1" />',
			'<img class="smile" src="/img/smileys/face-crying.png" alt="\1" />',
			'<img class="smile" src="/img/smileys/face-glasses.png" alt="\1" />',
		);
		return preg_replace($from, $to, $text);
	}
}
?>